<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    //http://127.0.0.1:5500/day04/8.html#toA
    console.log("锚点:"+location.hash)
    console.log("主机+端口:"+location.host)
    console.log("主机:"+location.hostname)
    console.log("端口:"+location.port)
    console.log("协议:"+location.protocol)
    //http://127.0.0.1:5500/day04/8.html?id=1&name=aaa
    console.log("请求参数:"+location.search)
    var param = location.search
    var ay = param.substring(1).split("&")
    console.log("第一个参数:"+ay[0])
    console.log("第二个参数:"+ay[1])
  </script>
</head>
<body>
  <button onclick="location.reload()">刷新reload()</button>
  <button onclick="location.href='8.html'">刷新 href </button>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p>data</p>
  <p id="toA">aaaa</p>
  <p>data</p>
</body>
</html>